Skip to content

Conversation

@SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch https://github.com/sourcery-ai-bot/NLOS-Track main
git merge --ff-only FETCH_HEAD
git reset HEAD^

super(PAC_Cell, self).__init__()

assert model_name in ['PAC_Net', 'P_Net', 'C_Net', 'baseline']
assert model_name in {'PAC_Net', 'P_Net', 'C_Net', 'baseline'}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PAC_Cell.__init__ refactored with the following changes:

self.v_loss = v_loss

assert model_name in ['PAC_Net', 'P_Net', 'C_Net', 'baseline']
assert model_name in {'PAC_Net', 'P_Net', 'C_Net', 'baseline'}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PAC_Net_Base.__init__ refactored with the following changes:

hx = self.warmup_rnn(fx)[1] # (2, B, D)

return hx
return self.warmup_rnn(fx)[1]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function C_Net.warm_up refactored with the following changes:

This removes the following comments ( why? ):

# (2, B, D)


world_size = len(dist_cfgs['device_ids'].split(','))
dist_cfgs['distributed'] = True if world_size > 1 else False
dist_cfgs['distributed'] = world_size > 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function main refactored with the following changes:

Comment on lines -60 to -65
if phase == 'train':
if phase == 'test':
return full_dataset
elif phase == 'train':
train_size = int(len(full_dataset) * train_ratio)
val_size = len(full_dataset) - train_size
return random_split(full_dataset, [train_size, val_size])
elif phase == 'test':
return full_dataset
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function split_dataset refactored with the following changes:

  • Simplify conditional into switch-like form (switch)

ascii=(platform.version() == 'Windows'))

for step in range(len_loader):
for _ in range(len_loader):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trainer_tracking.train refactored with the following changes:

Comment on lines -485 to +490
logger.info(f'Performance on validation set at epoch: {epoch + 1}\n' + res_table.get_string())
logger.info(
f'Performance on validation set at epoch: {epoch + 1}\n{res_table.get_string()}'
)

return (self.val_metrics['x_loss'], self.val_metrics['v_loss']), \
(self.val_metrics['pcm'], self.val_metrics['area'], self.val_metrics['dtw'])
(self.val_metrics['pcm'], self.val_metrics['area'], self.val_metrics['dtw'])
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trainer_tracking.val refactored with the following changes:

Comment on lines -491 to +493
assert phase in ['train', 'val']
assert phase in {'train', 'val'}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Trainer_tracking.test_plot refactored with the following changes:

lc.set_linewidth(3)
line = ax.add_collection(lc)
fig.colorbar(line, ax=ax, ticks=idxs[::int(len(idxs) / 10)], label='step')
fig.colorbar(line, ax=ax, ticks=idxs[::len(idxs) // 10], label='step')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function draw_route refactored with the following changes:


def draw_routes(routes: tuple[ndarray, ndarray], return_mode: str = None):
assert return_mode in ['plt_fig', 'fig_array', None]
assert return_mode in {'plt_fig', 'fig_array', None}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function draw_routes refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant